<!DOCTYPE html>
<html>
<head>
<base href="${basePath}">
<meta charset="UTF-8">
<head>
<title>修改任务</title>
$!{include("import_js_css.html")}
</head>
<body>
	<!-- #set(Task task,List<User> responsibles) -->
	$!{include("header.html")}
	<div class="menu_all">
		<div class="div_search_result clear">
			<div class="panel-heading panel-result-title">
				<h3 class="panel-title">修改任务</h3>
			</div>
			<div class="panel-form-add">
				<form class="form-horizontal" role="form" action="yueyogaAdmin/addTask.jhtml"
					method="POST">
					<div class="panel-form-layout">
						<label for="txtTaskName" class="col-sm-1 control-label">任务名称</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" id="txtTaskName"
								value="${task.name}" readOnly >
							<input type="hidden" value="${task.id}" name="taskId"/>
						</div>
						<label for="selStatus" class="col-sm-1 control-label">工作安排</label>
						<div class="col-sm-3">
							<select class="selectpicker show-menu-arrow"
								data-live-search="true" data-width="100%" name="subStatusId"
								id="selStatus">
								<!--#for(Status s: taskTypes)-->
								<!-- #if(s.id==task.subStatusId) -->
								<option value="${s.id}" selected>${s.name}</option>
								<!-- #else -->
								<option value="${s.id}">${s.name}</option>
								<!-- #end -->
								<!-- #end -->
							</select>
						</div>
						<br> <br> <label for="txtExpirydate"
							class="col-sm-1 control-label">到期时间</label>
						<div class="col-sm-3">
							<div class='input-group date' id='txtExpirydate' data-date-format="YYYY-MM-DD">
			                    <input name="expirydate" type='text' class="form-control" value="${task.expirydate.format('yyyy-MM-dd')}" />
			                    <span class="input-group-addon"><span class="glyphicon glyphicon-time"></span>
			                    </span>
			                </div>
						</div>
						<label for="selPerson" class="col-sm-1 control-label">负责人</label>
						<div class="col-sm-3">
							<select class="selectpicker show-menu-arrow"
								data-live-search="true" data-width="100%" name="resporId"
								id="selPerson">
								<!--#for(GroupUserModel u:responsibles)-->
								<option value="${u.id}">${u.name}</option>
								<!-- #end -->
							</select>
						</div>
						<br /> <br /> <label for="selTaskType"
							class="col-sm-1 control-label">任务类型</label>
						<div class="col-sm-3">
							<select class="selectpicker show-menu-arrow" data-width="100%"
								name="type" id="selTaskType">
								<option value="${task.type}">${task.type=='1'?'会员':'组'}</option>
							</select>
						</div>
						<div id="ta_mbr_div">
							<label for="selTaskMember" class="col-sm-1 control-label">会员</label>
							<div class="col-sm-3">
								<select name="memberId" class="selectpicker show-menu-arrow" data-width="100%">
									<option value="${task.member.memberid}">${task.member.name}</option>
								</select>
							</div>
						</div>
						<div id="ta_gps_div" style="display: none;">
							<label for="selTaskGroups" class="col-sm-1 control-label">组</label>
							<div class="col-sm-3">
								<select class="selectpicker show-menu-arrow"
									data-live-search="true" data-width="100%" name="gpsId"
									id="selTaskGroups">
									<option>&nbsp;${task.group.name}</option>
								</select>
							</div>
						</div>
						<br /> <br /> <label for="txtRemarks"
							class="col-sm-1 control-label">任务备注</label>
						<div class="col-sm-3">
							<textarea style="height:115px;" class="form-control panel-form-address" name="remarks"  id="txtRemarks">${task.remarks}</textarea>
						</div>
						<br> <br> <br> <br><br> <br> <br>
						<div class="panel-btn-search">
							<button type="submit" class="btn btn-default btn-ade-default panel-mr">保存</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
$("#selPerson").select2('val', '${task.resporId}');
function documentReady() {
			var taskType = '${task.type}';
			var resporId = '${task.resporId}';
			if (taskType == '1') {
				$("#ta_mbr_div").show();
				$("#ta_gps_div").hide();
			} else {
				$("#ta_gps_div").show();
				$("#ta_mbr_div").hide();
			}
			$("#selPerson").val(resporId);

		$("#txtExpirydate").datetimepicker({
			language: "zh-CN",
			pickTime: false
		});
		
		var msg = '${msg}';
		if (msg && msg=='dqsjtx') {
			var d = alert("到期时间不能早于今天");
			setTimeout(function(){
				d.close().remove();
				window.location.href = "yueyogaAdmin/toEditTask.jhtml?taskId="+'${task.id}';
			},1000);
		}
		
		//去掉下拉输入框
		$("#selStatus").select2({
			width: "100%",
			minimumResultsForSearch: -1
		});
		
		$("#selTaskType").select2({
			width: "100%",
			minimumResultsForSearch: -1
		});
	}
</script>
</html>